<!DOCTYPE html>
<html class="pixel-ratio-1"><head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>茵曼商城</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="css/sm.min.css">
    <link rel="stylesheet" href="css/sm-extend.min.css">
    <link rel="stylesheet" href="css/inman.css">
    <script src="https://hm.baidu.com/hm.js?5ee51ef74fa865950bb9a2757fdb33ad"></script><script type="text/javascript" src="js/zepto.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/sm.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/sm-extend.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/functions.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/TouchSlide.1.1.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/jweixin-1.0.0.js"></script>
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?5ee51ef74fa865950bb9a2757fdb33ad";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
    <style type="text/css">.full-html,.full-body{width: 100% !important;height: 100% !important;margin: 0 !important;overflow: hidden !important;}.full-body *{display: none !important;}.full-iframe {display: block !important;}.full-inpage {width: 100% !important;height: 100% !important;margin: 0 !important;overflow: hidden !important;background: rgb(243, 243, 247) !important;}.full-inpage > *:not(.ntalk-mobile-inpage-background) {display: none !important;}</style><script type="text/javascript" async="async" charset="utf-8" src="http://sh-trail.ntalker.com/trail/trail/userinfo.php?action=getregion&amp;siteid=kf_9154&amp;userid=kf_9154_ISME9754_1122715&amp;callback=trail_getregion_87D9615B"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/zh_cn.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011054" data-requiremodule="lang"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/chat.in.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011054" data-requiremodule="chatManage"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/mqtt31.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011054" data-requiremodule="MQTT"></script><script type="text/javascript" async="async" charset="utf-8" src="http://dl.ntalker.com/js/xn6/mqtt.chat.js?siteid=kf_9154&amp;v=nt6.92&amp;t=2017.08.25_011054" data-requiremodule="Connection"></script></head>
<body><div class="page-group personaldata-page">
    <div class="page page-current" id="personaldata-page">
        <!--标题栏-->
        <header class="bar bar-nav">
            <a class="icon icon-left pull-left" href="javascript:history.back(-1);"></a>

            <h1 class="title">个人资料</h1>
        </header>
        <!--内容区-->
        <div class="content native-scroll">
            <div class="box1">
                <ul>
                    <li><a href="javascript:void(0)" id="change-headimg">
                        <span>头像</span>
                        <div class="box1-1">
                            <img src="http://img.inman.com.cn/public/images/6a/7e/70/7b2d446b716b59ae3cd3f7d65628ece4c74ea5b0.png">
                        </div>
                        <div class="cb"></div>
                    </a></li>
                    <li><a href="#edit-nickname">
                        <span>昵称</span>

                        <div class="box1-1">
                            15910288070                            </div>
                        <div class="cb"></div>
                    </a></li>

                    <li><a href="#">
                        <span>手机</span>
                        <div class="box1-1">
                            15910288070                                </div>
                        <div class="cb"></div>
                    </a></li>
                    <li><a href="http://m.inman.com.cn/index.php/User/address">
                        <span>我的收货地址</span>
                        <div class="box1-1">
                        </div>
                        <div class="cb"></div>
                    </a>
                    </li>
                    <li><a href="http://m.inman.com.cn/index.php/User/updatenewpwd">
                        <span>修改密码</span>
                        <div class="box1-1">
                        </div>
                        <div class="cb"></div>
                    </a>
                    </li>
                    <li style="display:none"><a href="http://m.inman.com.cn/index.php/shop/comment?shop_code=&amp;shopName=">
                        <span>我的茵曼+</span>
                        <div class="box1-1">
                        </div>
                        <div class="cb"></div>
                    </a>
                    </li>
                    <li><a href="#edit-email">
                        <span>邮箱</span>
                        <div class="box1-1">
                        </div>
                        <div class="cb"></div>
                    </a>
                    </li>
                    <li>
                        <a href="#edit-birthday">
                            <span>生日</span>

                            <div class="box1-1">
                            </div>
                            <div class="cb"></div>
                        </a></li>
                    <li>
                        <p>
                            会员生日当天会有意外惊喜，请确保填写的生日与身份证一致，填写后不予修改！
                        </p>
                    </li>
                </ul>
            </div>

            <!--div class="box2">
                <ul>
                    <li>
                        <a href="http://m.inman.com.cn/index.php/User/mylevel">
                            <p>等级:新会员</p>
                        </a>
                    </li>
                    <li>
                        <a href="http://m.inman.com.cn/index.php/User/mypoints">
                            <p>积分</p>
                        </a>
                    </li>
                    <li>
                        <a href="http://m.inman.com.cn/index.php/User/pointsmall" >
                            <p>积分商城</p>
                        </a>
                    </li>
                    <li>
                        <a href="#">
                            <p>积分说明</p>
                        </a>
                    </li>
                </ul>
            </div-->
            <!--头像修改表单-->
            <!--form action="" method="post" enctype="multipart/form-data" id="uploadimg" style="display:block;"-->
            <input type="file" name="file" accept="image/*" id="uploadFile" style="display:none;">
            <!--/form-->
        </div>
    </div>

    <!------------内联页 修改邮箱----------->
    <div class="page editpersonaldata-page" id="edit-email">
        <!--标题栏-->
        <header class="bar bar-nav">
            <a class="icon icon-left pull-left back" href="#"></a>
            <a class="icon icon-check pull-right" id="edit-bt"></a>
            <h1 class="title">修改邮箱</h1>
        </header>

        <!--内容区-->
        <div class="content">
            <div class="list-block">
                <ul>
                    <li>
                        <div class="item-content">
                            <div class="item-media"><i class="icon icon-form-name"></i></div>
                            <div class="item-inner">
                                <div class="item-title label">邮箱</div>
                                <div class="item-input">
                                    <input type="text" placeholder="请输入您的邮箱" id="new-email">
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="tip">
                <p>示例 xiaoming@inman.com</p>
            </div>
        </div>
    </div>

    <!------------内联页 修改昵称------------>
    <div class="page editpersonaldata-page" id="edit-nickname">
        <!--标题栏-->
        <header class="bar bar-nav">
            <a class="icon icon-left pull-left back" href="#"></a>
            <a class="icon icon-check pull-right" id="edit-nickname-bt"></a>

            <h1 class="title">修改昵称</h1>
        </header>

        <!--内容区-->
        <div class="content">
            <div class="list-block">
                <ul>
                    <li>
                        <div class="item-content">
                            <div class="item-media"><i class="icon icon-form-name"></i></div>
                            <div class="item-inner">
                                <div class="item-title label">昵称</div>
                                <div class="item-input">
                                    <input type="text" placeholder="请输入新的昵称" id="new-nickname">
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <!------------内联页 填写生日------------>
    <div class="page editpersonaldata-page" id="edit-birthday">
        <!--标题栏-->
        <header class="bar bar-nav">
            <a class="icon icon-left pull-left back" href="#"></a>
            <a class="icon icon-check pull-right" id="edit-birthday-bt"></a>

            <h1 class="title">填写生日</h1>
        </header>

        <!--内容区-->
        <div class="content">
            <div class="list-block">
                <ul>
                    <li>
                        <div class="item-content">
                            <div class="item-media"><i class="icon icon-form-name"></i></div>
                            <div class="item-inner">
                                <div class="item-title label">生日</div>
                                <div class="item-input">
                                    <input type="text" data-toggle="date" name="" id="birthday">
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <script>
        $.fn.resizeImage = function (obj) {
            var file = obj.that.files[0];
            var URL = window.URL || window.webkitURL;
            var blob = URL.createObjectURL(file);
            var base64;
            var img = new Image();
            img.src = blob;
            if (!/image\/\w+/.test(obj.that.files[0].type)) {
                $.toast("请上传图片！", 1000);
                return false;
            }
            img.onload = function () {
                if(img.width < obj.limitWid){
                    $.toast('图片宽度不得小于'+ obj.limitWid +'px',1000);
                    return false;
                }
                var that = this;
                //生成比例
                var w, scale, h = that.height;
                if (obj.cutWid == '') {
                    w = that.width;
                } else {
                    w = obj.cutWid;
                }
                scale = w / h;
                h = w / scale;
                //生成canvas
                var canvas = document.createElement('canvas');
                var ctx = canvas.getContext('2d');
                $(canvas).attr({
                    width: w,
                    height: h
                });
                ctx.drawImage(that, 0, 0, w, h);
                // 生成base64
                base64 = canvas.toDataURL('image/jpeg', obj.quality || 0.8);
                var result = {
                    base64: base64
                };
                //成功后的回调
                obj.success(result);
            };
        };

        //上传头像
        $(function () {
            $("#uploadFile").change(function () {
                $.showIndicator();
                $(this).resizeImage({
                    that: this,
                    cutWid: '',
                    quality: 1,
                    limitWid: '',
                    success: function (data) {
                        var uri = "http://m.inman.com.cn/index.php/User/uploadAvatar";
                        $.ajax({
                            cache: true,
                            type: "POST",
                            url: uri,
                            data: {imgpath: data.base64},
                            async: false,
                            success: function (json) {
                                $.hideIndicator();
                                json = eval('(' + json + ')');
                                if (json.errcode != '1') {
                                    $.toast(json.errmsg);
                                    return false;
                                }

                                if (json.errmsg != '') {
                                    $.toast(json.errmsg);
                                }
                                $.toast(json.errmsg);
                                if (json.errcode && json.url !== '') {
                                    setTimeout(function () {
                                        window.location.href = json.url;
                                    }, 1000);
                                }
                            }
                        });
                    }
                });
            });

            $('#change-headimg').click(function () {
                $("#uploadFile").trigger("click");
            });
            //修改email
            $('#edit-bt').click(function () {
                var data = $('#new-email').val();
                var rule = /\w+[@]{1}\w+[.]\w+/;
                if (!rule.test(data)) {
                    $.toast("要输入一个有效的邮箱呦");
                    return false;
                }
                $.showPreloader('正在处理');
                var uri = "http://m.inman.com.cn/index.php/User/updateUser";
//            $.showIndicator();
                $.ajax({
                    cache: true,
                    type: "POST",
                    url: uri,
                    data: {data: data, type: '2'},
                    async: false,
                    success: function (json) {
//                    $.hideIndicator();
                        $.hidePreloader();
                        json = eval('(' + json + ')');
                        if (json.errcode != '1') {
                            $.toast(json.errmsg);
                            return false;
                        }
                        $.toast(json.errmsg);
                        if (json.errcode && json.url !== '') {
                            setTimeout(function () {
                                window.location.href = json.url;
                            }, 1000);
                        }

                    }
                });
                setTimeout(function () {
//                $.hidePreloader();
                    $.hidePreloader();
                    $.toast("操作成功");
                }, 2000);
            });


            //修改昵称
            $('#edit-nickname-bt').click(function () {
                var nickname = $('#new-nickname').val();
                if (nickname.length < 1) {
                    $.toast("新的昵称太短了呦");
                    return false;
                }
                $.showIndicator();
                var uri = "http://m.inman.com.cn/index.php/User/updateUser";
                $.ajax({
                    cache: true,
                    type: "POST",
                    url: uri,
                    data: {data: nickname, type: '1'},
                    async: false,
                    success: function (json) {
                        $.hideIndicator();
                        json = eval('(' + json + ')');
                        if (json.errcode != '1') {
                            $.toast(json.errmsg);
                            return false;
                        }
                        $.toast(json.errmsg);
                        if (json.errcode && json.url !== '') {
                            setTimeout(function () {
                                window.location.href = json.url;
                            }, 1000);
                        }

                    }
                });
            });

            //填写生日
            $('#edit-birthday-bt').click(function () {
                var birthday = $('#birthday').val();
                if (birthday == '') {
                    $.toast("您还没有填写生日呦");
                    return false;
                }
                var uri = "http://m.inman.com.cn/index.php/User/updateUser";
                $.showIndicator();
                $.ajax({
                    cache: true,
                    type: "POST",
                    url: uri,
                    data: {data: birthday, type: '3'},
                    async: false,
                    success: function (json) {
                        $.hideIndicator();
                        json = eval('(' + json + ')');
                        if (json.errcode != '1') {
                            $.toast(json.errmsg);
                            return false;
                        }
                        $.toast(json.errmsg);
                        if (json.errcode && json.url !== '') {
                            setTimeout(function () {
                                window.location.href = json.url;
                            }, 1000);
                        }

                    }
                });
            });
        });
        $.init();
    </script>
</div><div id="nTalk_post_hiddenElement" style="left: -10px; top: -10px; visibility: hidden; display: none; width: 1px; height: 1px;"></div>



</body></html>